home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 5_11.lha / 5_11 / 5_11a.c < prev    next >
C/C++ Source or Header  |  1993-08-08  |  642b  |  30 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / included within get_token()        DELETE
  6. efault:
  7.    if (isalpha(ch))
  8. {
  9. // read in the name
  10. char namestring[100];
  11. char *p = namestring;
  12. for (*p++ = ch;
  13.      input.get(ch) &&
  14.      (isalnum(ch) || (ch == '_'));
  15.      *p++ = ch)
  16.     ;
  17. input.putback(ch);
  18. *p = 0;
  19.  
  20. // save the name
  21. curr_tok.cvalue = new char[p - namestring + 1];
  22. strcpy(curr_tok.cvalue, namestring);
  23. curr_tok.type = NAME;
  24.  
  25. // insert the name into the variable name table
  26. name *n = variables->insert(curr_tok.cvalue);
  27. n->lvalue = 0;
  28. return;
  29. }
  30.